/*function setCookie(name, value) {
    var Days = 30;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}

function getCookie(name) {
    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    if (arr = document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}

function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null)
        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}

function checkCookie() {
    if (getCookie("userName") == null || getCookie("roleName") == null) {
        alert("未登录!");
        window.location.href = "login.jsp";
    }
}

function clearCookie() {
    delCookie("userName");
    delCookie("roleName");
    window.location.href = "login.jsp";
}*/
function getCurrentDateTime(){
	 var date=new Date();
	 var year=date.getFullYear();
	 var month=date.getMonth()+1;
	 var day=date.getDate();
	 var hours=date.getHours();
	 var minutes=date.getMinutes();
	 var seconds=date.getSeconds();
	 return year+"-"+formatZero(month)+"-"+formatZero(day)+" "+formatZero(hours)+":"+formatZero(minutes)+":"+formatZero(seconds);
 }
function getCurrentDate(){
	 var date=new Date();
	 var year=date.getFullYear();
	 var month=date.getMonth()+1;
	 var day=date.getDate();
	 return year+"-"+formatZero(month)+"-"+formatZero(day);
}
 function formatZero(n){
	 if(n>=0&&n<=9){
		 return "0"+n;
	 }else{
		 return n;
	 }
 }
 
 function cureentDateTime(){
	//创建日期时间对象
     var datetime = new Date();
     //获取组件
     var year = datetime.getFullYear();
     var month = datetime.getMonth() + 1;
     var day = datetime.getDate();
     var hour = datetime.getHours();
     var minute = datetime.getMinutes();
     var second = datetime.getSeconds();
     var week = datetime.getDay();
     //转换星期格式
     switch (week) {
         case 0:
             var week = '星期日';
             break;
         case 1:
             var week = '星期一';
             break;
         case 2:
             var week = '星期二';
             break;
         case 3:
             var week = '星期三';
             break;
         case 4:
             var week = '星期四';
             break;
         case 5:
             var week = '星期五';
             break;
         case 6:
             var week = '星期六';
             break;
     }
     var now =  year + "年" + formatZero(month) + "月" + formatZero(day) + "日" + " " + formatZero(hour) + ":" + formatZero(minute) + ":" + formatZero(second) + " " + week;
     return now;
 }